﻿(function () {
    'use strict';
    var skillTypeController = function ($scope, $log, $location, $routeParams, skillTypeFactory, skillTypesInit) {
        $scope.skillTypes = skillTypesInit;
        

        function init() {
            console.log("skillTypeController.init");
            $scope.getSkillTypes();
        }

        $scope.getSkillTypes = function() {
            skillTypeFactory.getSkillTypes()
                .then(function(data) {
                    if (data) {
                        $scope.skillTypes = data;
                        $log.log(data);
                    }
                });
        };

        $scope.edit = function(skillType) {
            alert("edit:" + skillType.name);
        }

        $scope.remove = function (skillType) {
            alert("remove:" + skillType.name);
        }

        $scope.addSkillType = function () {
            $location.path('/joesweb/skillType/add');
        }

        //init();
    };

    skillTypeController.$inject = ['$scope', '$log', '$location', '$routeParams', 'skillTypeFactory', 'skillTypesInit'];
    angular.module('app')
        .controller('SkillTypeController', skillTypeController);
}());